<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{$config['site_name']}</title>
<meta name="keywords" content="{$config['keywords']}" />
<meta name="description" content="{$config['description']}"/>
<link href="__TMPL__skin/css/fafa.css" rel="stylesheet" type="text/css" />
<link href="__TMPL__skin/css/validator.css" rel="stylesheet" type="text/css" />


<script type="text/javascript"  language = "javascript" src="__TMPL__skin/js/tools.js"></script>
<script type="text/javascript"  language = "javascript" src="__TMPL__skin/js/jquery.js"></script>
   
    <script src="__TMPL__/skin/js/formvalidator.js" type="text/javascript"></script>
    <script src="__TMPL__/skin/js/formvalidatorregex.js" type="text/javascript"></script>
    <style>
    	.selected {
			 selected="selected";	
			}
    </style>
</head>

<body>
<include file="Index:header" />
<div class="container">
  <div class="content">
    <div class="mq"></div>
    <div class="subheader">
      <h1>免费注册会员</h1>
    </div>
    <div id="Panel1"> 
      <script type="text/javascript">    
	      function yzsetn() {
              $("#yz").val('');
          }
		  

          $(document).ready(function () {

			
		$("#yzask").change(function(){
				  var selectedval = $(this).val(); //得到当前点击的值  
				  $("#yzask").attr("item",selectedval);
				  
				  //赋值给inpu
				   $("#myselect").val(selectedval);
				    
				  
				
			});
			
		    $("#v").click(function(){
				  var url ="/Admin.php?m=Public&a=verify&t="+ Math.random();
				  $(this).attr('src',url);
			});
              $.formValidator.initConfig({ formid: "form1", onerror: function (msg) { }, onsuccess: function () { } });
			  
			  
			  /*用户名验证*/
              $("#username").formValidator({ onshow: "请输入用户名", onfocus: "用户名至少3个字符,最多12个字符", oncorrect: "该用户名可以注册" }).inputValidator({ min: 3, max: 12, onerror: "你输入的用户名非法,请确认" }).regexValidator({ regexp: "userregname", datatype: "enum", onerror: "用户名格式不正确" })
 	.ajaxValidator({
	        type: "get",
	        url: "index.php?m=Public&a=checkUsername&username="+ $("#username").val(),
	        datatype: "json",
	        success: function (data) {				
	            if (data == "0") {
	                return true;
	            }
	            else {
	                return false;
	            }
	        },
	        buttons: $("#submit"),
	         error: function(jqXHR, textStatus, errorThrown){alert("服务器没有返回数据，可能服务器忙，请重试");},
	        onerror: "该用户名不可用，请更换用户名",
	        onwait: "正在对用户名进行合法性校验，请稍候..."
	    });
		

			/*电子邮箱验证*/
           $('#email').formValidator({ onshow: "请输入邮箱", onfocus: "邮箱6-30个字符", oncorrect: "邮件格式正确" }).inputValidator({ min: 6, max: 30, onerror: "请输入正确的邮箱格式,请确认" }).regexValidator({ regexp: "^([\\w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([\\w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$", onerror: "你输入的邮箱格式不正确" })
   .ajaxValidator({
	        type: "get",
	        url: "index.php?m=Public&a=checkEmail&email="+ $("#email").val(),
	        datatype: "json",
	        success: function (data) {				
	            if (data == "0") {
	                return true;
	            }
	            else {
	                return false;
	            }
	        },
	        buttons: $("#submit"),
	         error: function(jqXHR, textStatus, errorThrown){alert("服务器没有返回数据，可能服务器忙，请重试");},
	        onerror: "该邮箱不可用，请更换邮箱",
	        onwait: "正在对用户名进行合法性校验，请稍候..."
	    });

	
	/*回答问题验证*/
		  $("#yzask").formValidator({ onshow: "请选择问题答案", onfocus: "请选择问题答案", oncorrect: "输入正确" }).inputValidator({ min: 1, onerror: "请选择问题答案" })
	    .ajaxValidator({
	        type: "get",
	        url: "index.php?m=Public&a=checkAsk&index="+$("#ask").attr("item")+"&id=myselect",
	        datatype: "json",
	        success: function (data) {
	            if (data == "1") {
	                return true;
	            }
	            else {
	                return false;
	            }
	        },
	        buttons: $("#submit"),
	        error: function () { alert("服务器没有返回数据，可能服务器忙，请重试"); },
	        onerror: "问题回答错误",
	        onwait: "正在对回答进行合法性校验，请稍候..."
	    });



		/*验证码验证*/
		
             $("#verify").formValidator({ onshow: "请输入验证码", onfocus: "请输入验证码", oncorrect: "验证码正确" }).inputValidator({ min: 1, max: 10, onerror: "验证码错误" })
	    .ajaxValidator({
	        type: "get",
	        url: "index.php?m=Public&a=checkVerify&verify="+$('#verify').val(),
	        datatype: "json",
	        success: function (data) {
	            if (data == "1") {
	                return true;
	            }
	            else {
	                return false;
	            }
	        },
	        buttons: $("#submit"),
	        error: function () { alert("服务器没有返回数据，可能服务器忙，请重试"); },
	        onerror: "验证码错误",
	        onwait: "正在对验证码进行合法性校验，请稍候..."
	    });


		
				
              $("#userpassword").formValidator({ onshow: "请输入密码", onfocus: "密码不能为空", oncorrect: "密码合法" }).inputValidator({ min: 1, empty: { leftempty: false, rightempty: false, emptyerror: "密码两边不能有空符号" }, onerror: "密码不能为空,请确认" });
			  
              $("#sUserPassword").formValidator({ onshow: "请输入重复密码", onfocus: "两次密码必须一致哦", oncorrect: "密码一致" }).inputValidator({ min: 1, empty: { leftempty: false, rightempty: false, emptyerror: "重复密码两边不能有空符号" }, onerror: "重复密码不能为空,请确认" }).compareValidator({ desid: "userpassword", operateor: "=", onerror: "2次密码不一致,请确认" });
			  
              $("#product").formValidator({ onshow: "请输入主营产品", onfocus: "请输入主营产品", oncorrect: "输入正确" }).inputValidator({ min: 2, max: 150, onerror: "请输入2-150正确的长度" });
			  
              $("#name").formValidator({ onshow: "请输入联系人", onfocus: "请输入联系人", oncorrect: "输入正确" }).inputValidator({ min: 2, max: 30, onerror: "请输入2-30正确的长度" });
			  
              $("#tel").formValidator({ onshow: "请输入联系电话", onfocus: "请输入联系电话", oncorrect: "输入正确" }).inputValidator({ min: 2, max: 30, onerror: "请输入2-30正确的长度" });
			  
              $("#address").formValidator({ onshow: "请输入联系地址", onfocus: "请输入联系地址", oncorrect: "输入正确" }).inputValidator({ min: 2, max: 100, onerror: "请输入2-30正确的长度" });
          });
          function qiyename() {
              if (GetRadioValue("usershoptype") == "1") {
                  $("#company").formValidator({ onshow: "请输入企业名称", onfocus: "请输入企业名称", oncorrect: "输入正确" }).inputValidator({ min: 2, max: 50, onerror: "请输入2-50正确的长度" });
              }
              else {
                  $("#company").formValidator({ onshow: "请输入企业名称", onfocus: "请输入企业名称", oncorrect: "输入正确" }).inputValidator({ min: 0 });
              }
          }
</script>
<form action="" method="post" id="form1">
      <table border="0" cellpadding="4" cellspacing="4" width="90%">
        <tbody>
          <tr>
            <td class="f14 tr" style="width:130px;"><span class="fred fs f12">*&nbsp;</span>所在城市：</td>
            <td><select name="city" id="city" class="input">
                   <volist name="list" id="v">
               		 <if condition="$v['city'] eq $cityname">
                      	 <option selected="selected" value="{$v['id']}">{$v.initial}{$v['city']}</option>
                    <else /> 
                      	 <option value="{$v['id']}">{$v.initial}{$v['city']}</option>
              		</if>  
                </volist>
              </select></td>
          </tr>
          <tr>
            <td class="f14 tr"><span class="fred fs f12">*&nbsp;</span>登录帐号：</td>
            <td><div class="fl">
                <input name="username" id="username" class="input" style="width:250px;" type="text">
              </div>
              <span id="usernameTip" class="onShow">请输入用户名</span></td>
          </tr>
          <tr>
            <td class="f14 tr"><span class="fred fs f12">*&nbsp;</span>登录密码：</td>
            <td><div class="fl">
                <input name="userpassword" id="userpassword" class="input" style="width:250px;" type="password">
              </div>
              <span id="userpasswordTip" class="onShow">请输入密码</span></td>
          </tr>
          <tr>
            <td class="f14 tr"><span class="fred fs f12">*&nbsp;</span>重复密码：</td>
            <td><div class="fl">
                <input name="sUserPassword" id="sUserPassword" class="input" style="width:250px;" type="password">
              </div>
              <span class="onShow" id="sUserPasswordTip">请输入重复密码</span></td>
          </tr>
          <tr>
            <td class="f14 tr"><span class="fred fs f12">*&nbsp;</span>电子邮箱：</td>
            <td><div class="fl">
                <input name="email" id="email" class="input" style="width:250px;" type="text">
              </div>
              <span class="onShow" id="emailTip">请输入邮箱</span></td>
          </tr>
          <tr>
            <td class="f14 tr"><span class="fred fs f12">*&nbsp;</span>用户类型：</td>
            <td><input class="bedeck" name="category" value="1" onclick="$('#cpname').css('display','');qiyename();" type="radio">
              企业　
              <input class="bedeck" name="category" checked="checked" value="0" onclick="$('#cpname').css('display','none');qiyename();" type="radio">
              个人</td>
          </tr>
          <tr id="cpname" style="display:none">
            <td class="f14 tr"><span class="fred fs f12">*&nbsp;</span>企业名称：</td>
            <td><div class="fl">
                <input name="company" maxlength="150" id="company" class="input" style="width:250px;" type="text">
              </div>
              <span id="companyTip"></span></td>
          </tr>
          <tr>
            <td class="f14 tr"><span class="fred fs f12">*&nbsp;</span>主营产品：</td>
            <td><div class="fl">
                <input name="product" maxlength="100" id="product" class="input" style="width:450px;" type="text">
              </div>
              <span class="onShow" id="productTip">请输入主营产品</span></td>
          </tr>
          <tr>
            <td class="f14 tr"><span class="fred fs f12">*&nbsp;</span>联系人：</td>
            <td><div class="fl">
                <input name="name" id="name" class="input" style="width:150px;" type="text">
              </div>
              <span class="onShow" id="nameTip">请输入联系人</span></td>
          </tr>
          <tr>
            <td class="f14 tr"><span class="fred fs f12">*&nbsp;</span>联系电话：</td>
            <td><div class="fl">
                <input name="tel" id="tel" class="input" style="width:150px;" type="text">
              </div>
              <span class="onShow" id="telTip">请输入联系电话</span></td>
          </tr>
          <tr>
            <td class="f14 tr"><span class="fred fs f12">*&nbsp;</span>联系地址：</td>
            <td><div class="fl">
                <input name="address" id="address" class="input" style="width:250px;" type="text">
              </div>
              <span class="onShow" id="addressTip">请输入联系地址</span></td>
          </tr>
          <tr>
            <td class="f14 tr"><span class="fred fs f12">*&nbsp;</span>验证码：</td>
            <td><div class="fl">
                <input name="verify" id="verify" class="input" style="width:100px;" type="text">
              </div>
              <img src="/Admin.php?m=Public&a=verify"  alt="验证码,看不清楚?请点击刷新验证码" id="v" style="cursor:pointer; float:left; margin:2px 3px 0px 3px;"> <span class="onShow" id="verifyTip">请输入验证码</span></td>
          </tr>

<tr>
        <td class="f14 tr"><span class="fred fs f12">*&nbsp;</span>验证问题：</td>
	    <td><div class="fl">
        
        <input type="hidden" id="myselect" value="" name="myselect" />
        <select name="yzask" id="yzask" class="input" />        
        <option  value="0">请选择答案</option>
        
        <for start="1" end="101">     
        <option value="{$i}">{$i}</option>      
        </for>
        
        </select>
        </div>
 
           <span style="display:inline-block; float:left; height:30px; line-height:30px; font-size:14px; padding-left:5px; color:#000;" id="ask" item="{$ask['index']}">{$ask['ask']}</span>
            <span id="yzaskTip" ></span>
        </td>
	</tr>

          <tr>
            <td>&nbsp;</td>
            <td style=" padding-top:10px;">
               <input name="submit" value="注册会员" id="submit" class="btnf" type="submit">
               <span id="Label1" style="color:Red;"></span> <span id="Label2" style="color:Red;"></span></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td style="font-size:14px; padding-top:10px; padding-bottom:10px;"> 如你已经有账号了， <a href="{:U('Public/login')}">点此登录</a>！</td>
          </tr>
        </tbody>
      </table> </form>
    </div>
  </div>
</div>

<include file="Index:footer" />
</body>
</html>